package com.jt.config;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import com.jt.pojo.User;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/*什么是bean；
*           Spring容器管理的对象
* */
@Configuration//标识为一个配置类 相当于早期的xml文件
public class MyBatisPlusConfig {
    /*
    * @bean 将方法返回值交给Spring容器管理
    *  shopMapper.selectPage(page,queryWrapper); 启动时自动屌用*/
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MARIADB));
        return interceptor;
    }
//    @Bean
//    User user (){
//        User user = new User();
//        user.setId(1222);
//        return user;
//    }
}

